package main

import (
	"gvb_server/core"
	_ "gvb_server/docs"
	"gvb_server/flags"
	"gvb_server/global"
	"gvb_server/routers"
)

// @title gvb_server API文档
// @version 1.0
// @description gvb_server API文档
// @host 127.0.0.1:8080
// @BasePath /
func main() {
	// 读取配置文件
	core.InitConf()
	// 初始化日志
	global.Log = core.InitLogger()
	// 初始化数据库  连接数据库
	global.DB = core.InitGorm()
	// 连接redis
	global.Redis = core.ConnectRedis()
	// 连接es
	global.ESClient = core.EsConnect()

	// 命令行参数绑定
	option := flags.Parse()
	if option.Run() {
		return
	}

	// 设置路由测试
	router := routers.InitRouter()
	addr := global.Config.System.Addr()
	global.Log.Infof("gvb_service 运行在： %s", addr)
	router.Run(addr)
} //TIP See GoLand help at <a href="https://www.jetbrains.com/help/go/">jetbrains.com/help/go/</a>.
// Also, you can try interactive lessons for GoLand by selecting 'Help | Learn IDE Features' from the main menu.
